@@ -0,0 +1,58 @@ |
||
| 1 |
+@admin_panel |
|
| 2 |
+Feature: Admin Panel |
|
| 3 |
+ In order to administer a website |
|
| 4 |
+ As the owner/admin of the system |
|
| 5 |
+ I want to config the website thru an admin panel |
|
| 6 |
+ |
|
| 7 |
+ Background: |
|
| 8 |
+ Given the following blog_post list |
|
| 9 |
+ | title | content | published | description | slug | |
|
| 10 |
+ | Hello World | Welcome to the website | true | First Post | hello_world | |
|
| 11 |
+ | Test 001 | 1 2 3 testing | true | Testing the website | test_001 | |
|
| 12 |
+ |
|
| 13 |
+ |
|
| 14 |
+ Scenario: Admin navigates to Dashboard |
|
| 15 |
+ Given I am logged in as admin |
|
| 16 |
+ When I click in the link "Admin Panel" |
|
| 17 |
+ Then I should see "Dashboard" |
|
| 18 |
+ And I should see "2 Posts" |
|
| 19 |
+ And I should see "2 Users" |
|
| 20 |
+ And I should see "0 Files" |
|
| 21 |
+ And I should see "0/0 Messages" |
|
| 22 |
+ |
|
| 23 |
+ Scenario: Registered user trying to access the Admin Panel |
|
| 24 |
+ Given I am logged in as user |
|
| 25 |
+ When I go to the admin dashboard |
|
| 26 |
+ Then I should see "You dont have permission to access that page!" |
|
| 27 |
+ |
|
| 28 |
+ Scenario: Unregistered user trying to access the Admin Panel |
|
| 29 |
+ Given I am not logged in |
|
| 30 |
+ When I go to the admin dashboard |
|
| 31 |
+ Then I should see "You dont have permission to access that page!" |
|
| 32 |
+ |
|
| 33 |
+ Scenario: Admin navigates to configurations page |
|
| 34 |
+ Given I am logged in as admin |
|
| 35 |
+ When I click in the link "Admin Panel" |
|
| 36 |
+ And I click in the link "Configurations" |
|
| 37 |
+ Then I should see in the field "Tagline" the text "A Ruby on Rails app template" |
|
| 38 |
+ |
|
| 39 |
+ Scenario: Registered user trying to access the configurations page |
|
| 40 |
+ Given I am logged in as user |
|
| 41 |
+ When I go to the configurations page |
|
| 42 |
+ Then I should see "You dont have permission to access that page!" |
|
| 43 |
+ |
|
| 44 |
+ Scenario: Unregistered user trying to access the configurations page |
|
| 45 |
+ Given I am not logged in |
|
| 46 |
+ When I go to the configurations page |
|
| 47 |
+ Then I should see "You dont have permission to access that page!" |
|
| 48 |
+ |
|
| 49 |
+ @focus |
|
| 50 |
+ Scenario: Change the website name and Tagline |
|
| 51 |
+ Given I am logged in as admin |
|
| 52 |
+ When I go to the configurations page |
|
| 53 |
+ Then I fill in "info_website_name" with "Testing Website Name" |
|
| 54 |
+ And I fill in "info_tagline" with "Just another cucumber test" |
|
| 55 |
+ And I click in the button "Update Config" |
|
| 56 |
+ Then I should see "Testing Website Name" |
|
| 57 |
+ And I should see in the field "info_website_name" the text "Testing Website Name" |
|
| 58 |
+ And I should see in the field "Tagline" the text "Just another cucumber test" |
@@ -1,4 +1,4 @@ |
||
| 1 |
-Feature: Manage Articles |
|
| 1 |
+Feature: Blog Posts |
|
| 2 | 2 |
In order to make a blog |
| 3 | 3 |
As an author |
| 4 | 4 |
I want to create and manage blog psots |
@@ -13,7 +13,6 @@ Feature: Contact Messages |
||
| 13 | 13 |
And I click in the button "submit_contact_message" |
| 14 | 14 |
Then I should see "Message sent!" |
| 15 | 15 |
|
| 16 |
- @focus |
|
| 17 | 16 |
Scenario: Send Contact Message as a user |
| 18 | 17 |
Given I am logged in as user |
| 19 | 18 |
And I go to the homepage |
@@ -0,0 +1,4 @@ |
||
| 1 |
+Then(/^I should see in the field "(.*?)" the text "(.*?)"$/) do |arg1, arg2| |
|
| 2 |
+ value = find_field(arg1).value |
|
| 3 |
+ value.should have_content(arg2) |
|
| 4 |
+end |
@@ -10,8 +10,14 @@ Then(/^I log in as admin$/) do |
||
| 10 | 10 |
admin_login |
| 11 | 11 |
end |
| 12 | 12 |
|
| 13 |
+Given(/^I am not logged in$/) do |
|
| 14 |
+ logout(:user) |
|
| 15 |
+end |
|
| 16 |
+ |
|
| 13 | 17 |
def user_login |
| 14 |
- user = FactoryGirl.create(:user) |
|
| 18 |
+ if User.find_by_first_name("John") == nil
|
|
| 19 |
+ user = FactoryGirl.create(:user) |
|
| 20 |
+ end |
|
| 15 | 21 |
visit new_user_session_path |
| 16 | 22 |
fill_in "Email", :with => 'johndoe@website.com' |
| 17 | 23 |
fill_in "Password", :with => '12345678' |
@@ -6,6 +6,12 @@ module NavigationHelpers |
||
| 6 | 6 |
|
| 7 | 7 |
when/the homepage/ |
| 8 | 8 |
root_path |
| 9 |
+ |
|
| 10 |
+ when/the admin dashboard/ |
|
| 11 |
+ visit admin_dashboard_path |
|
| 12 |
+ |
|
| 13 |
+ when/the configurations page/ |
|
| 14 |
+ visit admin_config_path |
|
| 9 | 15 |
|
| 10 | 16 |
when/the blog page/ |
| 11 | 17 |
visit blog_path |